/*gcc -c -o gtkButton.o gtkButton.c `pkg-config --cflags --libs gtk+-2.0`*/
#include "mygtk.h"
#include <string.h>
#include <gtk/gtk.h>

void toggle_statusbar(GtkWidget *widget, gpointer statusbar);

Widget_t *createButton(char* text, _Bool ATL)
{
	GtkWidget *button;
	if (ATL) {
		char label[128] = "_";
		strcat(label, text);
		button = gtk_button_new_with_mnemonic(label);
	} else
		button = gtk_button_new_with_label(text);
	return button;
}

Widget_t *createCheckButton(char *text, _Bool checked)
{
	GtkWidget *button;
	button = gtk_check_menu_item_new_with_label(text);
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(button), checked);
	
	/*
	GtkWidget *statusbar;
	statusbar = gtk_statusbar_new();
	gtk_widget_show(statusbar);
	g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(toggle_statusbar), statusbar);
	*/
	return button;
}

Widget_t *createRadioButton()
{
	GtkWidget *button;
	return button;
}

void setButtonFocusTip(Widget_t* button, char* tip)
{
	gtk_widget_set_tooltip_text(button, tip);
}

/*
#define setButtonClickAction(button, func) \
	g_signal_connect(button, "clicked", G_CALLBACK(func), NULL)
*/

void toggle_statusbar(GtkWidget *widget, gpointer statusbar)
{
	printf("111\n");
	if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
		gtk_widget_show(statusbar);
	else
		gtk_widget_hide(statusbar);
}